import Vue from 'vue'
import VueRouter from 'vue-router'
import LoginRouter from "@/views/account/router"
import DetailRouter from '@/views/detail/router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: { name: 'home' }
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('@/views/homepage.vue')
  },
  {
    path: '/article',
    name: 'article',
    component: () => import('@/views/article.vue')
  },
  ...LoginRouter,
  ...DetailRouter,
  {
    path: '/class',
    name: 'class',
    component: () => import('@/views/class.vue')
  },
  {
    path: '/coding',
    name: 'coding',
    component: () => import('@/views/codingLesson.vue')
  },
  {
    path: '/free',
    name: 'free',
    component: () => import('@/views/freeLesson.vue')
  },
  {
    path: '/live',
    name: 'live',
    component: () => import('@/views/live.vue')
  },
  {
    path: '/read',
    name: 'read',
    component: () => import('@/views/read.vue')
  },
  {
    path: '/wiki',
    name: 'wiki',
    component: () => import('@/views/wiki.vue')
  },

  {
    path: '*',
    redirect: { name: 'home' }
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})
export default router
